Shading and texture mapping are the most compute intensive and power hungry stages of the 3D graphics pipeline illustrated in FIG. 1. Power consumption in texture mapping is dissipated primarily in memory accesses. In geometry processing, lighting computation takes up to 83% of geometry transformation clock cycles.
Lighting computation determines the color intensity of each pixel within a rendered primitive. Illumination is the transport of luminous flux (measure of perceived power of light) from light sources through direct and indirect paths, and may be adjusted to reflect the varying sensitivity of the eye to different wavelengths of light. Lighting refers to the interaction between materials and light sources, thus determining the intensity of color for each pixel. Shading determines the color of a pixel based on illumination and lighting models.
A simplified and widely used model for lighting is referred to as the Phong Illumination Equation which describes reflected light intensity in terms of ambient, diffuse, and specular components and it is computed for each R, G, B component and for each light source. The equation is given as:
  I  =                    k        a            ·              I        a              +                  ∑                  i          =          1                n            ⁢                          ⁢                        I          li                ⁡                  (                                                    k                d                            ⁡                              (                                                      N                    →                                    ·                                                            L                      →                                        i                                                  )                                      +                                                            k                  s                                ⁡                                  (                                                                                    R                        →                                            i                                        ·                                          V                      →                                                        )                                            S                                )                    
where the ‘a’ terms refer to ambient components of the illumination, the ‘d’ terms refer to diffuse components, and the ‘s’ terms refer to the specular components. The term ka is, a weighting constant, Ia is the ambient light source intensity, Ili is the intensity from each light source, kd is the diffusion weighting constant, N·L is the dot product of the surface normal with the direction of the light source, ks is the specular weighting constant, R·V is the dot product of the reflection vector of the light source about the normal to the surface with the viewing vector V, and S is the specular coefficient. This lighting model can be applied on a per-vertex basis, such as in a vertex shading block 120 of FIG. 1, and on a per-pixel basis in a fragment or pixel shading block 130.
The most compute-intensive part of calculating terms according to the Phong Illumination Equation is computation of the specular term, as it involves a power term. Computing the power term consumes the majority of clock cycles. The computation of a floating point number, referred to herein as the number, to the power of another floating point number, referred to herein as the power term, is very difficult to implement using standard hardware components. The best prior art methods to implement the computation of exponentiation in hardware include a software math library, table lookup of exponentiation, linear interpolation with table lookup, and Taylor/Chebyshev approximation which replaces exponentiation with a polynomial.
The best known methods of computing the Phong illumination Equation are illustrated in FIG. 2. In these methods, the specular term is transformed to the log domain, and the specular coefficient is multiplied with the transformed term in the log domain. Then the result is transformed back to decimal arithmetic using an anti-log transformation. The ambient and diffuse terms are computed outside of the log domain, which requires five separate floating point multiplications.
Log and anti-log approximations are currently implemented by using either table lookup, which can be memory intensive, or by using linear interpolation with either three intervals, which leads to a relatively high error, or more than six intervals, which adds complexity and area. Conventional multipliers used to compute the specular power term are either a full 32 b×32 b multiplier or a 24 b×24 b mantissa multiplier. The former requires increased area and hence power, and the latter results in lower precision.
Embodiments of the invention address these and other limitations of the prior art.